package cn.edu.scau.cmi.yangqing.client;

import java.net.URL;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.ResourceBundle;

import org.springframework.context.ApplicationContext;

import cn.edu.scau.cmi.yangqing.factory.Creator;
import cn.edu.scau.cmi.yangqing.factory.CreatorPICC;
import cn.edu.scau.cmi.yangqing.factory.CreatorPingan;
import cn.edu.scau.cmi.yangqing.factory.Insurance;
import cn.edu.scau.cmi.yangqing.spring.domain.Student;
import cn.edu.scau.cmi.yangqing.spring.util.ApplicationContextUtil;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Button;
import javafx.scene.control.ChoiceBox;
import javafx.scene.control.TextField;

public class MyController implements Initializable {

	   @FXML
	   private Button myButton;
	   
	   @FXML
	   private TextField name;
	   
	   @FXML
	   private TextField gender;
	   
	   @FXML
	   private TextField teacherName;
	   
	   private static Student student;
	   
	   public void initialize(URL location, ResourceBundle resources) {
	   }

	   public void showDateTime(ActionEvent event) {
		   ApplicationContext applicationContext = ApplicationContextUtil.getApplicationContext();
			student = (Student) applicationContext.getBean("yangqing");
			name.setText(student.getName());
			gender.setText(student.getGendar());
			teacherName.setText(student.getTutor().getName());
			System.out.println("该学生的名字为："+student.getName());
			System.out.println("该学生的性别为："+student.getGendar());
			System.out.println("该学生的老师为："+student.getTutor().getName());
	   }
	   
}
